package top.chmin.project.cloud.common.tool;

import top.chmin.project.cloud.common.entity.Page;

/**
 * chmin
 * 2023/12/15 11:35
 * cloud-builder
 */
public class LocalTool {

    private static final ThreadLocal<Page<?>> page = new ThreadLocal<>();
    private static final ThreadLocal<String> userId = new ThreadLocal<>();

    public static void setPage(Page<?> page) {
        LocalTool.page.set(page);
    }
    public static Page<?> getPage() {
        return page.get() == null ? new Page<>(1, 10) : page.get();
    }

    public static String getUserId() {
        return userId.get() == null ? "visitor" : userId.get();
    }

}
